Use std::env::EXE_SUFFIX in new tests
authorFlorian Hahn <flo@fhahn.com>
Thu, 24 Sep 2015 21:47:50 +0000 (23:47 +0200)
committerFlorian Hahn <flo@fhahn.com>
Wed, 30 Sep 2015 19:42:28 +0000 (21:42 +0200)
tests/test_cargo_clean.rs
tests/test_cargo_compile.rs

index 4b2828a6e81c134b077e64f171e78c760d0994a9..ff3313d9979842fb3ed9e41abc459264c46d026b 100644 (file)
@@ -1,3 +1,5 @@
+use std::env;
+
 use support::{project, execs, main_file, basic_bin_manifest};
 use hamcrest::{assert_that, existing_dir, existing_file, is_not};
 
@@ -74,16 +76,20 @@ test!(clean_multiple_packages {
                                         .arg("-p").arg("foo"),
                 execs().with_status(0));
 
+    let d1_path = &p.build_dir().join("debug").join("deps")
+                                .join(format!("d1{}", env::consts::EXE_SUFFIX));
+    let d2_path = &p.build_dir().join("debug").join("deps")
+                                .join(format!("d2{}", env::consts::EXE_SUFFIX));
+
+
     assert_that(&p.bin("foo"), existing_file());
-    assert_that(&p.build_dir().join("debug").join("deps").join("d1"), existing_file());
-    assert_that(&p.build_dir().join("debug").join("deps").join("d2"), existing_file());
+    assert_that(d1_path, existing_file());
+    assert_that(d2_path, existing_file());
 
     assert_that(p.cargo("clean").arg("-p").arg("d1").arg("-p").arg("d2")
                                 .cwd(&p.root().join("src")),
                 execs().with_status(0).with_stdout(""));
     assert_that(&p.bin("foo"), existing_file());
-    assert_that(&p.build_dir().join("debug").join("deps").join("d1"),
-                is_not(existing_file()));
-    assert_that(&p.build_dir().join("debug").join("deps").join("d2"),
-                is_not(existing_file()));
+    assert_that(d1_path, is_not(existing_file()));
+    assert_that(d2_path, is_not(existing_file()));
 });
index affa96bc9ab92cbd386e066a45cd0208528fdc6a..cd1714c1876df2c903bec4b61df3fb79a09284af 100644 (file)
@@ -1975,12 +1975,16 @@ test!(build_multiple_packages {
     assert_that(process(&p.bin("foo")).unwrap(),
                 execs().with_stdout("i am foo\n"));
 
-    assert_that(&p.build_dir().join("debug").join("deps").join("d1"), existing_file());
-    assert_that(process(&p.build_dir().join("debug").join("deps").join("d1")).unwrap(),
-                execs().with_stdout("d1"));
+    let d1_path = &p.build_dir().join("debug").join("deps")
+                                .join(format!("d1{}", env::consts::EXE_SUFFIX));
+    let d2_path = &p.build_dir().join("debug").join("deps")
+                                .join(format!("d2{}", env::consts::EXE_SUFFIX));
 
-    assert_that(&p.build_dir().join("debug").join("deps").join("d2"), existing_file());
-    assert_that(process(&p.build_dir().join("debug").join("deps").join("d2")).unwrap(),
+    assert_that(d1_path, existing_file());
+    assert_that(process(d1_path).unwrap(), execs().with_stdout("d1"));
+
+    assert_that(d2_path, existing_file());
+    assert_that(process(d2_path).unwrap(),
                 execs().with_stdout("d2"));
 });